#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<assert.h>
typedef int Datatype;
typedef struct SLNode
{
	Datatype x;
	struct SLNode* next;
}SLNode;
SLNode* Initail()
{
	SLNode* phead = (SLNode*)malloc(sizeof(SLNode));
	assert(phead);
	phead->x = 0;
	phead->next = NULL;
	return phead;
}
void SLPush(SLNode* head, Datatype m)
{
	assert(head);
	SLNode* p = (SLNode*)malloc(sizeof(SLNode));
	assert(p);
	p->x = m;
	p->next = NULL;
	while (head->next)
	{
		head = head->next;
	}
	head->next = p;
}
void  SLPrint(SLNode* head)
{
	head = head->next;
	while (head)
	{
		printf("%d ", head->x);
		head = head->next;
	}
}
void DeletSL_same(SLNode* p1, SLNode* p2)
{
	assert(p1);
	assert(p2);
	SLNode* p=p1;
	while (p1&&p1->next)
	{
		SLNode* p3 = p2->next;
		int flag = 1;
		while (p3)
		{
			if (p1->next->x == p3->x)
			{
				p = p1->next->next;
				free(p1->next);
				flag = 0;
				p1->next = p;
				break;
			}
			p3 = p3->next;
		}
		if(flag)
		p1 = p1->next;
	}
}
int main()
{
	SLNode* head = Initail();
	SLNode* head2 = Initail();
	while (1)
	{
		int y = 0;
		scanf("%d", &y);
		if (y == 0)
			break;
		else
		{
			SLPush(head, y);
		}
	}
	while (1)
	{
		int y = 0;
		scanf("%d", &y);
		if (y == 0)
			break;
		else
		{
			SLPush(head2, y);
		}
	}
	DeletSL_same(head, head2);
	SLPrint(head);
}